builder: Be a bit more strict about requires
authorMatthias Clasen <mclasen@redhat.com>
Wed, 11 Nov 2020 00:18:26 +0000 (19:18 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 11 Nov 2020 00:18:26 +0000 (19:18 -0500)
Check that the major version matches (without this, the
requires check is really toothless), but allow 3.99 to
match 4.0.

gtk/gtkbuilderparser.c

index c8e096aacb6567ebacb0b9570dbb03095b277761..b714a8e8698fd7496031140ce3fe511c4bd45e2b 100644 (file)
@@ -2016,13 +2016,16 @@ end_element (GtkBuildableParseContext  *context,
        */
       if (!strcmp (req_info->library, "gtk"))
         {
-          if (!GTK_CHECK_VERSION (req_info->major, req_info->minor, 0))
+          if (req_info->major == 4 && req_info->minor == 0)
+            {
+              /* We allow 3.99.x to pass as 4.0 */
+            }
+          else if (gtk_check_version (req_info->major, req_info->minor, 0) != NULL)
             {
               g_set_error (error,
                            GTK_BUILDER_ERROR,
                            GTK_BUILDER_ERROR_VERSION_MISMATCH,
-                           "Required %s version %d.%d, current version is %d.%d",
-                           req_info->library,
+                           "Required GTK version %d.%d, current version is %d.%d",
                            req_info->major, req_info->minor,
                            GTK_MAJOR_VERSION, GTK_MINOR_VERSION);
               _gtk_builder_prefix_error (data->builder, context, error);